CSS Secrets by Lea Verou
Author:Lea Verou
Language: eng
Format: epub
Publisher: O’Reilly Media, Inc.
Published: 2015-10-23T16:00:00+00:00
}
main::before {
content: '';
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;
background: rgba(255,0,0,.5); /* for debugging */
}
We also applied a semi-transparent red background, so we can see what we’re doing, otherwise debugging becomes difficult when we’re dealing with a transparent (and therefore, invisible) element. As you can see in Figure 4.18, our pseudo-element is currently above our content, thus obscuring it. We can fix this by adding z-index: -1; (Figure 4.20).
Be careful when using a negative z-index to move a child underneath its parent: if said parent is nested within other elements with backgrounds, the child will go below those as well.
Now it’s time to replace that semi-transparent red background, with one that actually matches our backdrop, either by copying over the <body> background, or by splitting it into its own rule. Can we blur now? Let’s try it:
Why not just use background: inherit on main::before? Because then it will inherit from main, not body, so the pseudo-element will get a semi-transparent white background as well.
body, main::before {
background: url("tiger.jpg") 0 / cover fixed;
}
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Content Management | Programming |
User Experience & Usability | User Generated Content |
Web Design | Web Marketing |
Web Services | Website Analytics |
Hello! Python by Anthony Briggs(9916)
The Mikado Method by Ola Ellnestam Daniel Brolund(9779)
Dependency Injection in .NET by Mark Seemann(9340)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7780)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Svelte with Test-Driven Development by Daniel Irvine(7174)
Test-Driven Development with PHP 8 by Rainier Sarabia(6899)
Layered Design for Ruby on Rails Applications by Dementyev Vladimir;(6768)
Secrets of the JavaScript Ninja by John Resig & Bear Bibeault(6533)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6417)
Web Development with Django by Ben Shaw Saurabh Badhwar(6234)
React Application Architecture for Production by Alan Alickovic(5957)
Jquery UI in Action : Master the concepts Of Jquery UI: A Step By Step Approach by ANMOL GOYAL(5806)
Kotlin in Action by Dmitry Jemerov(5065)
Audition by Ryu Murakami(4583)
Software Architecture for Web Developers by Mihaela Roxana Ghidersa(4456)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4317)
Accelerating Server-Side Development with Fastify by Manuel Spigolon Maksim Sinik & Matteo Collina(4304)
Functional Programming in JavaScript by Mantyla Dan(4038)
